package com.aizuda.boot.modules.business.feishu.domain.approval;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @Author sangyirong
 * @ClassName SynchronizationApprovalDTO
 * @Version 1.0
 * @Date 2025/7/23 10:47
 */
@Data
public class SynchronizationApprovalDTO {

    @Schema(description = "租户key")
    @NotNull
    private String tenantKey;

    @Schema(description = "审批定义返回编码")
    @NotNull
    private String approvalCode;

    @Schema(description = "飞书应用ID")
    private String appId;

    @Schema(description = "审批实例状态",example = "PENDING：审批中,APPROVED：审批流程结束，结果为同意,REJECTED：审批流程结束，结果为拒绝,CANCELED：审批发起人撤回" +
            "DELETED：审批被删除,HIDDEN：状态隐藏（不显示状态),TERMINATED：审批终止")
    @NotNull
    private String instanceStatus;

    @Schema(description = "审批实例ID")
    @NotNull
    private String instanceId;

    @Schema(description = "合同ID")
    private String contractId;

    @Schema(description = "任务ID")
    private String taskId;

    @Schema(description = "审批标题")
    private String title;

    @Schema(description = "申请人ID")
    private String applyUserId;

    @Schema(description = "审批实例开始时间")
    private Date startTime;

    @Schema(description = "审批实例结束时间")
    private Date endTime;

    @Schema(description = "审批实例更新时间")
    private Date updateTime;

    @Schema(description = "表单")
    private List<Form> forms;

    @Schema(description = "任务")
    private List<Task> tasks;

    @Schema(description = "抄送任务")
    private List<CcTask> ccTasks;


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Form {
        @Schema(description = "表单名称")
        private String name;

        @Schema(description = "表单值")
        private String value;
    }

    @Data
    public static class Task {

        @Schema(description = "任务ID")
        @NotNull
        private String taskId;

        @Schema(description = "任务处理人ID")
        @NotNull
        private String taskUserId;

        @Schema(description = "任务标题")
        private String taskTitle;

        @Schema(description = "任务状态")
        @NotNull
        private String taskStatus;

        @Schema(description = "扩展信息")
        private String extra;

        @Schema(description = "任务开始时间")
        private Date startTime;

        @Schema(description = "任务结束时间")
        private Date endTime;

        @Schema(description = "任务更新时间")
        private Date updateTime;

        @Schema(description = "节点ID")
        private String nodeId;

        @Schema(description = "节点名称")
        private String nodeName;
    }

    @Data
    public static class CcTask {

        @Schema(description = "抄送ID")
        private String ccId;

        @Schema(description = "抄送人ID")
        private String ccUserId;

        @Schema(description = "抄送状态")
        private String readStatus;

        @Schema(description = "抄送标题")
        private String title;

        @Schema(description = "抄送创建时间")
        private Date createTime;

        @Schema(description = "抄送更新时间")
        private Date updateTime;
    }


}
